Skip to content

fixed #136#137

Merged
lutzhamel merged 1 commit intodev-1.0.0from
issue-136
Feb 17, 2022
Merged

fixed #136#137
lutzhamel merged 1 commit intodev-1.0.0from
issue-136

Conversation

@lutzhamel
Copy link
Copy Markdown
Collaborator

@lutzhamel lutzhamel commented Feb 17, 2022

Structures should never push their scope onto the stack because then it is possible to have unqualified access to members as the bug report illustrated. This patch fixes this, rather than pushing the structure scope onto the stack we explicitly test for membership in the structure. The program,

load system io.

structure A with
   data a.
   data b.
   data c.

   function __init__
      with none do
        io @println (a,b,c,__init__).
        io @println (this @a, this @b, this @c, this @__init__).
      end
end

let o = A().

is now properly rejected with,

Error: members.ast: 10: 'a' is not defined

…d never push

their scope onto the stack because then it is possible to have unqualified access to
members.  This patch fixes this, rather than pushing the structure scope onto the
stack we explicitly test for membership in the structure.
Copy link
Copy Markdown
Collaborator

@olwmc olwmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@lutzhamel lutzhamel merged commit 81d60e9 into dev-1.0.0 Feb 17, 2022
@lutzhamel lutzhamel deleted the issue-136 branch February 17, 2022 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants